﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using FXnaInfrastructure;


namespace ASAermod.FileLayers
{
   public class Stage3Inp
    {

        string _fileName="aermet.inp";

        public string FileName
        {
            get { return _fileName; }
            set { _fileName = value; }
        }



        string _REPORT = "stage3.RPT";

        public string REPORT
        {
            get { return _REPORT; }
            set { _REPORT = value; }
        }


        string _MESSAGES = "stage3.ERR";

        public string MESSAGES
        {
            get { return _MESSAGES; }
            set { _MESSAGES = value; }
        }


        string _DATA="MERGE.DSK";

        public string DATA
        {
            get { return _DATA; }
            set { _DATA = value; }
        }


        string _OUTPUT = "stage3.SFC";

        public string OUTPUT
        {
            get { return _OUTPUT; }
            set { _OUTPUT = value; }
        }


        string _PROFILE = "stage3.PFL";

        public string PROFILE
        {
            get { return _PROFILE; }
            set { _PROFILE = value; }
        }


        string _XDATES;

       /// <summary>
       /// 输出的气象数据时间段
       /// </summary>
        public string XDATES
        {
            get { return _XDATES; }
            set { _XDATES = value; }
        }


        string _REFLEVEL="SUBNWS";

        public string REFLEVEL
        {
            get { return _REFLEVEL; }
            set { _REFLEVEL = value; }
        }



        string _WIND_DIR="RANDOM";

        public string WIND_DIR
        {
            get { return _WIND_DIR; }
            set { _WIND_DIR = value; }
        }



        string _NWS_HGT;

       /// <summary>
       /// 地面测风高度
       /// </summary>
        public string NWS_HGT
        {
            get { return _NWS_HGT; }
            set { _NWS_HGT = value; }
        }


        string _FREQ_SECT;


       /// <summary>
       /// 指定是按季度输入地标参数，还是按月
       /// MONTHLY 1
       /// SEASONAL 1
       /// </summary>
        public string FREQ_SECT
        {
            get { return _FREQ_SECT; }
            set { _FREQ_SECT = value; }
        }


        string _SECTOR;

       /// <summary>
       /// 1  0  360 表示指定0-360度均为统一扇区的地表参数
       /// </summary>
        public string SECTOR
        {
            get { return _SECTOR; }
            set { _SECTOR = value; }
        }


        List<string> _lstSITE_CHAR = new List<string>();

       /// <summary>
       /// 指定各组地面对应的地表参数
       /// 后续参数分别代表：季度，扇区(SECTOR)编号，反照率，BOWEN率，地表粗糙度
       /// 参数取值参照地表参数说明
       /// </summary>
        public List<string> LstSITE_CHAR
        {
            get { return _lstSITE_CHAR; }
           

        }


        public void WriteFiles(string path)
        {
            StringBuilder sb = new StringBuilder();

            ////////////////////////
            sb.AppendLine("JOB");

            sb.AppendLine("REPORT " + this.REPORT);
            sb.AppendLine("MESSAGES " + this.MESSAGES);


            /////////////////////////////////

            sb.AppendLine("METPREP ");


            sb.AppendLine("DATA "+this.DATA);

            sb.AppendLine("OUTPUT "+this.OUTPUT);

            sb.AppendLine("PROFILE "+this.PROFILE);


            sb.AppendLine("XDATES "+this.XDATES);

            sb.AppendLine("METHOD REFLEVEL "+this.REFLEVEL);

            sb.AppendLine("METHOD WIND_DIR "+this.WIND_DIR);



            sb.AppendLine("NWS_HGT WIND "+this.NWS_HGT);


            sb.AppendLine("FREQ_SECT "+this.FREQ_SECT);


            sb.AppendLine("SECTOR "+this.SECTOR);


            foreach (string item in LstSITE_CHAR)
            {
                sb.AppendLine("SITE_CHAR "+item);
                
            }



            ////////////////////////////////////////////



            string content = sb.ToString();

            FileHelper.WriteFile(path + this.FileName, content);



        }


    }
}
